import 'package:common_utils/src/log_util.dart';
import 'package:get/get.dart';
import 'package:testlzhu/bean/test_list_entity.dart';
import 'package:testlzhu/data/net/http_manager.dart';

import 'state.dart';

class MainLogic extends GetxController {
  final MainState state = MainState();

  /// 接收上个页面数据，并刷新操作
  ///  Get.to(()=> const PageTwo(),arguments: {"msg":"今天天气很好"});
  @override
  void onReady() {
    // var map = Get.arguments;
    // msg = map["msg"];
    update();
    super.onReady();
  }

  void increase() {
    ++state.count;
    update();
  }

  void bottab(int vvalue) {
    state.currentIndex = vvalue;
    update(['currentIndex']);
  }

  Future<void> getMainData() async {
    var data = <String, dynamic>{};
    data["relateType"] = "1";
    HttpManager().get<List<TestListEntity>>(
        // url: "index/index",
        url: "site/siteLista",
        params: data,
        baseUrl: "http://dev.lezhuwang.com/wisdom/app/",
        success: (data) {
          LogUtil.e("success--${data.length}");
        },
        error: (data) {
          print(data.message);
        });
  }

}
